/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: PACKAGE_NAME
 * @ClassName: teacher
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/10/10 12:19
 * @Copyright 金斗版板所有
 */
public class teacher {
    private String name;
    private String gender;
    private int age;
    private int schoolAge;
    private String theory;

    public teacher(String name, String gender, int age, int schoolAge, String theory) {
        this.setName(name);
        this.setGender(gender);
        this.setAge(age);
        this.setSchoolAge(schoolAge);
        this.setTheory(theory);
    }

    public void setTheory(String theory) {
        this.theory = theory;
    }

    public String getTheory() {
        return theory;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void setAge(int age) {
        if (age < 18 || age > 60) {
            System.out.println("年龄异常！");
        } else {
            this.age = age;
        }
    }

    public void setSchoolAge(int schoolAge) {
        if (schoolAge > 0) {
            this.schoolAge = schoolAge;
        } else {
            System.out.println("教龄必须大于10");
        }
    }

    public String getName() {
        return name;
    }

    public String getGender() {
        return gender;
    }

    public int getAge() {
        return age;
    }

    public int getSchoolAge() {
        return schoolAge;
    }
    public void show(){
        String elements=String.format("姓名："+this.getName()+"\t性别："+this.getGender()+"\t年龄："+this.age
        +"\t教龄："+this.getSchoolAge()+"\t所在中心："+this.getTheory());
    }
}
